﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Djs.Neuronic.UI.Interactive;

namespace Djs.Neuronic.UI
{
    public partial class TestInteractiveForm : Form
    {
        public TestInteractiveForm()
        {
            InitializeComponent();
            this.InitializeInteractiveArea();
            
        }

        private void InitializeInteractiveArea()
        {
            this._InterPanel.BorderStyle = BorderStyle.Fixed3D;
            this._InterPanel.IntDesktop.BackColor = Color.DarkBlue;

            IntArea area2;
            if (true)
            {
                _Area1 = new IntAnimatedColor() { Bound = new Rectangle(60, 15, 240, 60), BackColor = Color.BlueViolet };
                this._InterPanel.IntDesktop.AddChild(_Area1);
                _Area1.ColorLow = Color.YellowGreen;
                _Area1.ColorHigh = Color.PaleGreen;
                _Area1.AnimateTime = 3d;
                _Area1.AnimateMode = AnimateMode.CycleSinus;
                _Area1.Cursor = SysCursorType.Help;
                _Area1.MouseDragMode = MouseDragMode.Horizontal;
            }
            area2 = new IntArea() { Bound = new Rectangle(20, 90, 320, 60), BackColor = Color.CadetBlue };
            this._InterPanel.IntDesktop.AddChild(area2);
            area2.MouseDragMode = MouseDragMode.Vertical;
            area2.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

            if (false)
            {
                IntAnimatedColor iaa = new IntAnimatedColor() { Bound = new Rectangle(140, 60, 160, 60) };
                iaa.ColorLow = Color.ForestGreen;
                iaa.ColorHigh = Color.FromArgb(0, Color.Black); // .Transparent; //  Color.Firebrick;
                this._InterPanel.IntDesktop.AddChild(iaa);
                iaa.AnimateTime = 2.4d;
                iaa.AnimateMode = AnimateMode.CycleSinus;
                iaa.MouseDragMode = MouseDragMode.Horizontal;

                IntLabel label = new IntLabel() { Bound = new Rectangle(210, 130, 160, 30), Text = "Ukázka fontu" };
                label.ColorLow = this._InterPanel.IntDesktop.BackColor;
                label.ColorHigh = Color.White;
                label.Font = new Font(SystemFonts.DialogFont.Name, 11f, FontStyle.Bold);
                this._InterPanel.IntDesktop.AddChild(label);
                label.AnimateTime = 1.2d;
      //          label.AnimateMode = AnimateMode.CycleSinus;
            }
            if (true)
            {
                IntLabel lbl1 = new IntLabel() { Bound = new Rectangle(5, 5, 180, 60), Text = "Mizející text, který pohybuje parentem" };
                lbl1.ColorLow = Color.FromArgb(0, Color.Red);
                lbl1.ColorHigh = Color.BlueViolet;
                lbl1.Font = new Font(SystemFonts.DialogFont.Name, 11f, FontStyle.Bold | FontStyle.Italic);
                _Area1.AddChild(lbl1);
                lbl1.AnimateTime = 12.2d;
                // lbl1.AnimateMode = AnimateMode.CycleSinus;
                lbl1.Cursor = SysCursorType.No;
                lbl1.MouseDragMode = MouseDragMode.DragParent;
                lbl1.AnimateToLow(8, AnimateAutoLowMode.Hide);
            }

            if (true)
            {
                IntLabel lbl2 = new IntLabel() { Bound = new Rectangle(110, 140, 280, 90), Text = "Objevující se text, poměrně dlouhý, možná by mohl přetéct na další řádek?" };
                lbl2.ColorLow = Color.FromArgb(0, Color.LightSalmon);
                lbl2.ColorHigh = Color.Yellow;
                lbl2.Font = new Font(SystemFonts.DialogFont.Name, 11f, FontStyle.Bold);
                this._InterPanel.IntDesktop.AddChild(lbl2);
                lbl2.AnimateTime = 3.5d;
                // lbl2.AnimateMode = AnimateMode.CycleSinus;
                lbl2.Cursor = SysCursorType.Hand;
                lbl2.MouseDragMode = MouseDragMode.All;
                lbl2.Alignment = ContentAlignment.BottomCenter;
                lbl2.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
                lbl2.AnimateToHigh(9);
            }

            IntButton buttonLeft = new IntButton() { Bound = new Rectangle(40, 210, 34, 34) };
            this._InterPanel.IntDesktop.AddChild(buttonLeft);
            buttonLeft.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            buttonLeft.ImageNormal = PicLibrary.LeftGreen_Cached;
            buttonLeft.ImageHot = PicLibrary.LeftYellow_Cached;
            buttonLeft.ImageDown = PicLibrary.LeftRed_Cached;
            buttonLeft.MouseDragMode = MouseDragMode.All;
            buttonLeft.MouseClick += new InteractiveMouseHandler(buttonLeft_MouseClick);

            IntButton buttonRight = new IntButton() { Bound = new Rectangle(320, 210, 34, 34) };
            this._InterPanel.IntDesktop.AddChild(buttonRight);
            buttonRight.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            buttonRight.ImageNormal = PicLibrary.RightBlue_Cached;
            buttonRight.ImageHot = PicLibrary.RightYellow_Cached;
            buttonRight.ImageDown = PicLibrary.RightRed_Cached;
            buttonRight.MouseDragMode = MouseDragMode.All;
            buttonRight.MouseClick += new InteractiveMouseHandler(buttonRight_MouseClick);

            this._InterPanel.Refresh();
        }
        IntAnimatedColor _Area1;
        void buttonRight_MouseClick(object sender, InteractiveMouseArgs args)
        {
            _Area1.ColorLow = Color.FromArgb(0, Color.MediumPurple);
            _Area1.AnimateToLow(0.75d, AnimateAutoLowMode.Hide);
        }
        void buttonLeft_MouseClick(object sender, InteractiveMouseArgs args)
        {
            _Area1.ColorHigh = Color.DarkOrange;
            _Area1.AnimateToHigh(4.5d);
        }
    }
}
